"### OPTIONS ######################################################
syntax on                       "Syntax highlight
set mouse-=a                    "Allow visual select with mouse
set clipboard=unnamedplus		"Use system clipboard
"set number                      "Show line numbers
set hlsearch                    "Hightlight all matches on search
set ignorecase                  "Search are case insensitive
set smartcase                   "Search case sensitive if any caps are used
set incsearch                   "Show matches highlight when typing
"set expandtab 					"User apropiate number of spaces in autoindent and indent with <,>
set tabstop=4                   "Tab=4 spaces
set shiftwidth=4 				"Number of spaces to use for each step of (auto)indent
set smartindent                 "Auto add tabs according nested code
set showcmd						"Show partial command in status line
let g:netrw_banner = 0          "Hide header in :Explore mode
set cursorline 					"Hightlight current line
set wildmenu					"Visual autocomplete for command menu



"#### THEME #######################################################
set background=dark             "Background color
"let g:enable_bold_font = 1		"Enable bold in code
let g:enable_italic_font = 1	"Enable italic in code (comments)

"THEME IN 256 AND 88 COLORS
if (&t_Co == 256 || &t_Co == 88) && !has('gui_running')
	colorscheme hybrid_material
	set termguicolors
"THEME IN 8 AND 16 COLORS
else
  colorscheme apprentice
endif


"### PLUGINS OPTIONS ##############################################
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif   "Autoclose NERDTree if is last window
let g:better_whitespace_ctermcolor='darkgrey'       "Better-whitespace color in cterm
let g:better_whitespace_guicolor='darkgrey'         "Better-whitespace color in gui
let g:coc_disable_startup_warning = 1


"#### STATUSBAR ###############################################
if (&t_Co == 256 || &t_Co == 88) && !has('gui_running')
	set laststatus=2
	set noshowmode
	set statusline=
	set statusline+=%#DiffAdd#%{(mode()=='n')?'\ \ NORMAL\ ':''}
	set statusline+=%#DiffChange#%{(mode()=='i')?'\ \ INSERT\ ':''}
	set statusline+=%#DiffDelete#%{(mode()=='r')?'\ \ RPLACE\ ':''}
	set statusline+=%#Cursor#%{(mode()=='v')?'\ \ VISUAL\ ':''}
	set statusline+=\ %n\           			" buffer number
	set statusline+=%#Visual#       			" colour
	set statusline+=%{&paste?'\ PASTE\ ':''}
	set statusline+=%{&spell?'\ SPELL\ ':''}
	set statusline+=%#CursorIM#     			" colour
	set statusline+=%R                        	" readonly flag
	set statusline+=%M                        	" modified [+] flag
	set statusline+=%#Cursor#               	" colour
	set statusline+=%#CursorLine#     			" colour
	set statusline+=\ %t\                   	" short file name
	set statusline+=%=                          " right align
	set statusline+=%#CursorLine#   			" colour
	set statusline+=\ %Y\                   	" file type
	set statusline+=%#CursorIM#     			" colour
	set statusline+=\ %3l:%-2c\         		" line + column
	set statusline+=%#Cursor#       			" colour
	set statusline+=\ %3p%%\                	" percentage
	"##############################################################
endif
